home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 June / macformat-038.iso / Demos / Notting Hill / ATHLETICS / HOME / 00009.ls < prev    next >
Encoding:
Text File  |  1996-02-08  |  8.8 KB  |  312 lines

  1. on decode ActionList
  2.   global GfxChannel, SeqChannel, DVidChannel, PauseFor, AutoVidC, AutoVidX, AutoVidY, NewScreenID, CurrScreenID, AllScreen, first, ScreenID
  3.   set PauseFor to 60
  4.   repeat with e in ActionList
  5.     put "current decode.." & e
  6.     if listp(e) then
  7.       set FBcommand to getAt(e, 1)
  8.       if FBcommand = "NAV" then
  9.         set AutoVidC to 0
  10.         set NewScreenID to getAt(e, 2)
  11.         if count(e) > 2 then
  12.           set AutoVidX to 320
  13.           set AutoVidY to 240
  14.           set AutoVidC to getAt(e, 3)
  15.           if count(e) > 3 then
  16.             set AutoVidX to getAt(e, 4)
  17.             set AutoVidY to getAt(e, 5)
  18.           end if
  19.         end if
  20.       else
  21.         if FBcommand = "PLAY" then
  22.           if soundBusy(1) then
  23.             put "Stop the music"
  24.             repeat with k = 1 to 10
  25.               set the volume of sound 1 to integer((10 - k) / 11.0 * 255)
  26.               delaytime(3)
  27.             end repeat
  28.             sound stop 1
  29.             sound stop 2
  30.           end if
  31.           set the volume of sound 1 to 255
  32.           set locCurrScreen to CurrScreenID
  33.           set HoldAll to AllScreen
  34.           set DirMov to getAt(e, 2)
  35.           set first to 1
  36.           set ScreenID to 0
  37.           set CurrScreenID to 0
  38.           if count(e) > 2 then
  39.             set FrameIn to getAt(e, 3)
  40.             put "play frame FrameIn of movie DirMov " & FrameIn & " + " & DirMov
  41.           else
  42.             put "play movie DirMov " & DirMov
  43.             puppetSound(2, 12)
  44.             play movie DirMov
  45.           end if
  46.           go(1)
  47.         else
  48.           if (FBcommand = "GFX") or (FBcommand = "GFXP") then
  49.             set PicC to getAt(e, 2)
  50.             if count(e) > 2 then
  51.               set PicX to getAt(e, 3)
  52.               set PicY to getAt(e, 4)
  53.             else
  54.               set PicX to 320
  55.               set PicY to 240
  56.             end if
  57.             playGfx(PicC, PicX, PicY)
  58.             if FBcommand = "GFX" then
  59.               resetGfx()
  60.             end if
  61.           else
  62.             if FBcommand = "PAUSE" then
  63.               set PauseFor to getAt(e, 2)
  64.             else
  65.               if FBcommand = "SEQ" then
  66.                 playSeq(e)
  67.               else
  68.                 if FBcommand = "SND" then
  69.                   put "play sound button"
  70.                   set SndCast to getAt(e, 2)
  71.                   puppetSound(string(SndCast))
  72.                 else
  73.                   if FBcommand = "VID" then
  74.                     set VidC to getAt(e, 2)
  75.                     if count(e) > 2 then
  76.                       set VidX to getAt(e, 3)
  77.                       set VidY to getAt(e, 4)
  78.                     else
  79.                       set VidX to 320
  80.                       set VidY to 240
  81.                     end if
  82.                     playVideo(VidC, VidX, VidY)
  83.                   end if
  84.                 end if
  85.               end if
  86.             end if
  87.           end if
  88.         end if
  89.       end if
  90.       next repeat
  91.     end if
  92.     if stringp(e) then
  93.       if e = "END" then
  94.         exit repeat
  95.       else
  96.         if e = "UPS" then
  97.           updateStage()
  98.         else
  99.           if e = "SEQCLR" then
  100.             resetSeq()
  101.           else
  102.             if e = "QUIT" then
  103.               DePuppetAll()
  104.               puppetSound(2, 13)
  105.               updateStage()
  106.               repeat while soundBusy(2)
  107.                 nothing()
  108.               end repeat
  109.               quit()
  110.               exit
  111.             else
  112.             end if
  113.           end if
  114.         end if
  115.       end if
  116.       next repeat
  117.     end if
  118.   end repeat
  119. end
  120.  
  121. on DePuppetAll
  122.   repeat with J = 1 to 48
  123.     puppetSprite(J, 0)
  124.   end repeat
  125. end
  126.  
  127. on playSeq SeqElement
  128.   global SeqChannel, PauseFor
  129.   set StartCast to getAt(SeqElement, 2)
  130.   set EndCast to getAt(SeqElement, 3)
  131.   if count(SeqElement) > 3 then
  132.     set SeqX to getAt(SeqElement, 4)
  133.     set SeqY to getAt(SeqElement, 5)
  134.   else
  135.     set SeqX to 320
  136.     set SeqY to 240
  137.   end if
  138.   set the locH of sprite SeqChannel to SeqX
  139.   set the locV of sprite SeqChannel to SeqY
  140.   set TimeGap to PauseFor
  141.   if StartCast < EndCast then
  142.     repeat with M = StartCast to EndCast
  143.       set the castNum of sprite SeqChannel to M
  144.       updateStage()
  145.       delaytime(TimeGap)
  146.     end repeat
  147.   else
  148.     repeat with M = StartCast down to EndCast
  149.       set the castNum of sprite SeqChannel to M
  150.       updateStage()
  151.       delaytime(TimeGap)
  152.     end repeat
  153.   end if
  154. end
  155.  
  156. on delaytime aDelay
  157.   set aDelay to the timer + aDelay
  158.   repeat while the timer < aDelay
  159.   end repeat
  160. end
  161.  
  162. on playGfx PicCast, PicX, PicY
  163.   global GfxChannel, PauseFor
  164.   set the castNum of sprite GfxChannel to PicCast
  165.   set the locH of sprite GfxChannel to PicX
  166.   set the locV of sprite GfxChannel to PicY
  167.   updateStage()
  168.   startTimer()
  169.   repeat while the timer < PauseFor
  170.     nothing()
  171.   end repeat
  172. end
  173.  
  174. on playVideo VidCast, VidX, VidY
  175.   global DVidChannel
  176.   set the movieRate of sprite DVidChannel to 0
  177.   set the castNum of sprite DVidChannel to VidCast
  178.   set the locH of sprite DVidChannel to VidX
  179.   set the locV of sprite DVidChannel to VidY
  180.   set movLength to the duration of cast VidCast
  181.   updateStage()
  182.   set slip to 0
  183.   set the movieRate of sprite DVidChannel to 1
  184.   VideoControlsOn()
  185.   puppetSprite(37, 1)
  186.   puppetSprite(38, 1)
  187.   repeat while the movieTime of sprite DVidChannel < (movLength - slip)
  188.     set percent to 100.0 * the movieTime of sprite DVidChannel / movLength
  189.     showProgress(percent)
  190.     if the mouseDown then
  191.       set c to the mouseCast
  192.       put "Vid clicks " & c
  193.       set BaseVidControlCast to 60
  194.       set c to c - BaseVidControlCast
  195.       if c = 0 then
  196.         set the movieTime of sprite DVidChannel to 0
  197.       else
  198.         if c = 1 then
  199.           set HoldVol to the volume of sprite DVidChannel
  200.           set the volume of sprite DVidChannel to 1
  201.           set HoldSpeed to the movieRate of sprite DVidChannel
  202.           set the movieRate of sprite DVidChannel to -3
  203.           repeat while the mouseDown
  204.             set percent to 100.0 * the movieTime of sprite DVidChannel / movLength
  205.             showProgress(percent)
  206.             updateStage()
  207.           end repeat
  208.           set the volume of sprite DVidChannel to HoldVol
  209.           set the movieRate of sprite DVidChannel to HoldSpeed
  210.         else
  211.           if (c = 2) or (c = 5) then
  212.             set CurrSpeed to the movieRate of sprite DVidChannel
  213.             if CurrSpeed then
  214.               set the castNum of sprite 42 to BaseVidControlCast + 5
  215.               set the movieRate of sprite DVidChannel to 0
  216.               updateStage()
  217.             else
  218.               set the castNum of sprite 42 to BaseVidControlCast + 2
  219.               set the movieRate of sprite DVidChannel to 1
  220.               updateStage()
  221.             end if
  222.             repeat while the mouseDown
  223.             end repeat
  224.           else
  225.             if c = 3 then
  226.               set HoldVol to the volume of sprite DVidChannel
  227.               set the volume of sprite DVidChannel to 1
  228.               set HoldSpeed to the movieRate of sprite DVidChannel
  229.               set the movieRate of sprite DVidChannel to 6
  230.               repeat while the mouseDown
  231.                 set percent to 100.0 * the movieTime of sprite DVidChannel / movLength
  232.                 showProgress(percent)
  233.                 updateStage()
  234.               end repeat
  235.               set the volume of sprite DVidChannel to HoldVol
  236.               set the movieRate of sprite DVidChannel to HoldSpeed
  237.             else
  238.               if c = 4 then
  239.                 exit repeat
  240.               end if
  241.             end if
  242.           end if
  243.         end if
  244.       end if
  245.     end if
  246.     updateStage()
  247.     nothing()
  248.   end repeat
  249.   VideoControlsOff()
  250.   resetVideo()
  251. end
  252.  
  253. on ShowProgress1 percent
  254.   set the locH of sprite 38 to 620
  255.   set the locV of sprite 38 to 480 - (percent / 100.0 * 480)
  256. end
  257.  
  258. on showProgress percent
  259.   set R to 6.28000000000000025 * percent / 100.0
  260.   set x to 595 + (38 * sin(R))
  261.   set y to 460 - (15 * cos(R))
  262.   set the locH of sprite 38 to x
  263.   set the locV of sprite 38 to y
  264. end
  265.  
  266. on resetVideo
  267.   global DVidChannel
  268.   set the locH of sprite DVidChannel to -300
  269.   set the locV of sprite DVidChannel to -300
  270.   set the castNum of sprite DVidChannel to 4
  271.   set the castNum of sprite 37 to 3
  272.   set the castNum of sprite 38 to 3
  273. end
  274.  
  275. on resetGfx
  276.   global GfxChannel
  277.   set the castNum of sprite GfxChannel to 3
  278. end
  279.  
  280. on resetSeq
  281.   global SeqChannel
  282.   set the castNum of sprite SeqChannel to 3
  283. end
  284.  
  285. on ResetRoll
  286.   global OverChannel
  287.   set the castNum of sprite OverChannel to 3
  288. end
  289.  
  290. on VideoControlsOn
  291.   global RightVis
  292.   repeat with k = 40 to 44
  293.     puppetSprite(k, 1)
  294.     set the locH of sprite k to 320
  295.     set the locV of sprite k to 240
  296.     set the castNum of sprite k to 20 + k
  297.   end repeat
  298.   set RightVis to the locH of sprite 47
  299.   set the locH of sprite 47 to 3000
  300.   set the castNum of sprite 37 to 10
  301.   set the castNum of sprite 38 to 11
  302. end
  303.  
  304. on VideoControlsOff
  305.   global RightVis
  306.   repeat with k = 40 to 44
  307.     set the castNum of sprite k to 3
  308.     puppetSprite(k, 0)
  309.   end repeat
  310.   set the locH of sprite 47 to RightVis
  311. end
  312.